| Total Complexity | 2 | 
| Total Lines | 14 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | import {MigrationInterface, QueryRunner} from "typeorm"; | ||
| 2 | |||
| 3 | export class CooperativeSettings1605272527582 implements MigrationInterface { | ||
| 4 | name = 'CooperativeSettings1605272527582' | ||
| 5 | |||
| 6 |     public async up(queryRunner: QueryRunner): Promise<void> { | ||
| 7 |         await queryRunner.query(`CREATE TABLE "cooperative" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "dayDuration" integer NOT NULL DEFAULT 420, "addressId" uuid NOT NULL, CONSTRAINT "PK_b53942b37eb26a5d32a9a6ed455" PRIMARY KEY ("id"))`); | ||
| 8 |         await queryRunner.query(`ALTER TABLE "cooperative" ADD CONSTRAINT "FK_76076f95b4afaa794ca4a974661" FOREIGN KEY ("addressId") REFERENCES "address"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
| 9 |         await queryRunner.query(`INSERT INTO "address" VALUES('d784e499-1242-471c-9590-d3f77d1919ec', '2 rue Dieu', 'Paris', '75010', 'FR')`, undefined); | ||
| 10 |         await queryRunner.query(`INSERT INTO "cooperative" VALUES('863f007e-7490-4a8d-8f78-27230791de8d', 'Fairness', 420, 'd784e499-1242-471c-9590-d3f77d1919ec')`, undefined); | ||
| 11 | } | ||
| 12 | |||
| 13 |     public async down(queryRunner: QueryRunner): Promise<void> { | ||
| 14 | await queryRunner.query(`ALTER TABLE "cooperative" DROP CONSTRAINT "FK_76076f95b4afaa794ca4a974661"`); | ||
| 15 | await queryRunner.query(`DROP TABLE "cooperative"`); | ||
| 16 | } | ||
| 19 |